
<!DOCTYPE HTML>
<html lang="zh-hans" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>013_死锁 · 瑕家瑾轩_Note</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        <meta name="author" content="xiajiajinxuan">
        
        
    
    <link rel="stylesheet" href="../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-splitter/splitter.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-search-plus/search.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-page-toc-button/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-back-to-top-button/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-chapter-fold/chapter-fold.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-auto-scroll-table/website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    
        
    
        
    
        
    
        
    
        
    

        
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="014_邮件发送.html" />
    
    
    <link rel="prev" href="012_时间日期处理.html" />
    

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="输入并搜索" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../">
            
                <a href="../">
            
                    
                    介绍
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2" data-path="../001_git教程/001_安装配置.html">
            
                <a href="../001_git教程/001_安装配置.html">
            
                    
                    001_git教程
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.2.1" data-path="../001_git教程/001_安装配置.html">
            
                <a href="../001_git教程/001_安装配置.html">
            
                    
                    001_安装配置
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="../001_git教程/002_git常用语句及流程.html">
            
                <a href="../001_git教程/002_git常用语句及流程.html">
            
                    
                    002_git常用语句及流程
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="../002_gitbook教程/001_安装配置及使用.html">
            
                <a href="../002_gitbook教程/001_安装配置及使用.html">
            
                    
                    002_gitbook教程
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="../002_gitbook教程/001_安装配置及使用.html">
            
                <a href="../002_gitbook教程/001_安装配置及使用.html">
            
                    
                    001_安装配置及使用
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="../002_gitbook教程/002_生成文件目录.html">
            
                <a href="../002_gitbook教程/002_生成文件目录.html">
            
                    
                    002_生成文件目录
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="../003_typora/001_typora-markdown语法.html">
            
                <a href="../003_typora/001_typora-markdown语法.html">
            
                    
                    003_typora
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.4.1" data-path="../003_typora/001_typora-markdown语法.html">
            
                <a href="../003_typora/001_typora-markdown语法.html">
            
                    
                    001_typora-markdown语法
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.5" data-path="001_ORACLE关键字执行顺序.html">
            
                <a href="001_ORACLE关键字执行顺序.html">
            
                    
                    004_Oracle
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.5.1" data-path="001_ORACLE关键字执行顺序.html">
            
                <a href="001_ORACLE关键字执行顺序.html">
            
                    
                    001_ORACLE关键字执行顺序
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.2" data-path="002_关键字_between.html">
            
                <a href="002_关键字_between.html">
            
                    
                    002_关键字_between
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.3" data-path="003_数据库启停.html">
            
                <a href="003_数据库启停.html">
            
                    
                    003_数据库启停
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.4" data-path="004_http请求.html">
            
                <a href="004_http请求.html">
            
                    
                    004_http请求
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.5" data-path="005_NULL处理.html">
            
                <a href="005_NULL处理.html">
            
                    
                    005_NULL处理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.6" data-path="006_交集_并集_差集.html">
            
                <a href="006_交集_并集_差集.html">
            
                    
                    006交集并集_差集
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.7" data-path="007_字符处理.html">
            
                <a href="007_字符处理.html">
            
                    
                    007_字符处理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.8" data-path="008_字符排序.html">
            
                <a href="008_字符排序.html">
            
                    
                    008_字符排序
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.9" data-path="009_定时任务.html">
            
                <a href="009_定时任务.html">
            
                    
                    009_定时任务
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.10" data-path="010_数字处理.html">
            
                <a href="010_数字处理.html">
            
                    
                    010_数字处理
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.11" data-path="011_序列流水号.html">
            
                <a href="011_序列流水号.html">
            
                    
                    011_序列流水号
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.12" data-path="012_时间日期处理.html">
            
                <a href="012_时间日期处理.html">
            
                    
                    012_时间日期处理
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.5.13" data-path="013_死锁.html">
            
                <a href="013_死锁.html">
            
                    
                    013_死锁
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.14" data-path="014_邮件发送.html">
            
                <a href="014_邮件发送.html">
            
                    
                    014_邮件发送
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.15" data-path="015_转义字符.html">
            
                <a href="015_转义字符.html">
            
                    
                    015_转义字符
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.16" data-path="016_触发器.html">
            
                <a href="016_触发器.html">
            
                    
                    016_触发器
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.17" data-path="017_同义词.html">
            
                <a href="017_同义词.html">
            
                    
                    017_同义词
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.18" data-path="018_json解析.html">
            
                <a href="018_json解析.html">
            
                    
                    018_json解析
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.19" data-path="019_文件读写.html">
            
                <a href="019_文件读写.html">
            
                    
                    019_文件读写
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.20" data-path="020_用户创建及授权.html">
            
                <a href="020_用户创建及授权.html">
            
                    
                    020_用户创建及授权
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.5.21" data-path="021_中文字符验证.html">
            
                <a href="021_中文字符验证.html">
            
                    
                    021_中文字符验证
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.6" data-path="../005_EBS/001_ebs模块.html">
            
                <a href="../005_EBS/001_ebs模块.html">
            
                    
                    005_EBS
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.6.1" data-path="../005_EBS/001_ebs模块.html">
            
                <a href="../005_EBS/001_ebs模块.html">
            
                    
                    001_ebs模块
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.2" data-path="../005_EBS/002_API列表.html">
            
                <a href="../005_EBS/002_API列表.html">
            
                    
                    002_API列表
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.3" data-path="../005_EBS/003_FND_GLOBAL和FND_PROFILE.html">
            
                <a href="../005_EBS/003_FND_GLOBAL和FND_PROFILE.html">
            
                    
                    003_FND_GLOBAL和FND_PROFILE
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.4" data-path="../005_EBS/004_IE相关设置.html">
            
                <a href="../005_EBS/004_IE相关设置.html">
            
                    
                    004_IE相关设置
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.5" data-path="../005_EBS/005_MOAC.html">
            
                <a href="../005_EBS/005_MOAC.html">
            
                    
                    005_MOAC
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.6" data-path="../005_EBS/006_描述性弹性域.html">
            
                <a href="../005_EBS/006_描述性弹性域.html">
            
                    
                    006_描述性弹性域
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.7" data-path="../005_EBS/007_编译.html">
            
                <a href="../005_EBS/007_编译.html">
            
                    
                    007_编译
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.8" data-path="../005_EBS/008_界面数据查询.html">
            
                <a href="../005_EBS/008_界面数据查询.html">
            
                    
                    008_界面数据查询
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.9" data-path="../005_EBS/009_获取当前lov查询语句.html">
            
                <a href="../005_EBS/009_获取当前lov查询语句.html">
            
                    
                    009_获取当前lov查询语句
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.10" data-path="../005_EBS/010_表后缀.html">
            
                <a href="../005_EBS/010_表后缀.html">
            
                    
                    010_表后缀
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.11" data-path="../005_EBS/011_银行.html">
            
                <a href="../005_EBS/011_银行.html">
            
                    
                    011_银行
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.12" data-path="../005_EBS/012_错误代码及解释.html">
            
                <a href="../005_EBS/012_错误代码及解释.html">
            
                    
                    012_错误代码及解释
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.13" data-path="../005_EBS/013_WEBADI.html">
            
                <a href="../005_EBS/013_WEBADI.html">
            
                    
                    013_WEBADI
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.14" data-path="../005_EBS/014_请求参数间影响.html">
            
                <a href="../005_EBS/014_请求参数间影响.html">
            
                    
                    014_请求参数间影响
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.15" data-path="../005_EBS/015_FNDLOAD.html">
            
                <a href="../005_EBS/015_FNDLOAD.html">
            
                    
                    015_FNDLOAD
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.16" data-path="../005_EBS/016_配置文件.html">
            
                <a href="../005_EBS/016_配置文件.html">
            
                    
                    016_配置文件
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.17" data-path="../005_EBS/017_科目余额.html">
            
                <a href="../005_EBS/017_科目余额.html">
            
                    
                    017_科目余额
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.18" data-path="../005_EBS/018_供应商与客户.html">
            
                <a href="../005_EBS/018_供应商与客户.html">
            
                    
                    018_供应商与客户
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.19" data-path="../005_EBS/019_日记账.html">
            
                <a href="../005_EBS/019_日记账.html">
            
                    
                    019_日记账
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.20" data-path="../005_EBS/020_WebService发布与删除.html">
            
                <a href="../005_EBS/020_WebService发布与删除.html">
            
                    
                    020_WebService发布与删除
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.6.21" data-path="../005_EBS/021_报表开发.html">
            
                <a href="../005_EBS/021_报表开发.html">
            
                    
                    021_报表开发
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.7" data-path="../006_FORM/001_数字格式设置.html">
            
                <a href="../006_FORM/001_数字格式设置.html">
            
                    
                    006_FORM
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.7.1" data-path="../006_FORM/001_数字格式设置.html">
            
                <a href="../006_FORM/001_数字格式设置.html">
            
                    
                    001_数字格式设置
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.2" data-path="../006_FORM/002_Form状态.html">
            
                <a href="../006_FORM/002_Form状态.html">
            
                    
                    002_Form状态
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.3" data-path="../006_FORM/003_窗口消息.html">
            
                <a href="../006_FORM/003_窗口消息.html">
            
                    
                    003_窗口消息
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.4" data-path="../006_FORM/004_Form环境配置.html">
            
                <a href="../006_FORM/004_Form环境配置.html">
            
                    
                    004_Form环境配置
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.5" data-path="../006_FORM/005_打开窗口.html">
            
                <a href="../006_FORM/005_打开窗口.html">
            
                    
                    005_打开窗口
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.6" data-path="../006_FORM/006_日历LOV.html">
            
                <a href="../006_FORM/006_日历LOV.html">
            
                    
                    006_日历LOV
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.7" data-path="../006_FORM/007_form系统变量.html">
            
                <a href="../006_FORM/007_form系统变量.html">
            
                    
                    007_form系统变量
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.8" data-path="../006_FORM/008_层级与安全.html">
            
                <a href="../006_FORM/008_层级与安全.html">
            
                    
                    008_层级与安全
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.9" data-path="../006_FORM/009_item间关联.html">
            
                <a href="../006_FORM/009_item间关联.html">
            
                    
                    009_item间关联
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.7.10" data-path="../006_FORM/010_FORM界面数字百分比显示.html">
            
                <a href="../006_FORM/010_FORM界面数字百分比显示.html">
            
                    
                    010_FORM界面数字百分比显示
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.8" data-path="../007_工具/001_ASCLL对照表.html">
            
                <a href="../007_工具/001_ASCLL对照表.html">
            
                    
                    007_工具
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.8.1" data-path="../007_工具/001_ASCLL对照表.html">
            
                <a href="../007_工具/001_ASCLL对照表.html">
            
                    
                    001_ASCLL对照表
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.2" data-path="../007_工具/002_HTML转义字符.html">
            
                <a href="../007_工具/002_HTML转义字符.html">
            
                    
                    002_HTML转义字符
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.3" data-path="../007_工具/003_HTTP CONTENT_TYPE.html">
            
                <a href="../007_工具/003_HTTP CONTENT_TYPE.html">
            
                    
                    003_HTTP CONTENT_TYPE
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.8.4" data-path="../007_工具/004_HTTP状态码详解.html">
            
                <a href="../007_工具/004_HTTP状态码详解.html">
            
                    
                    004_HTTP状态码详解
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            本书使用 GitBook 发布
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href=".." >013_死锁</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div class="search-plus" id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <h1 id="&#x5F15;&#x8D77;&#x6B7B;&#x9501;&#x7684;&#x539F;&#x56E0;">&#x5F15;&#x8D77;&#x6B7B;&#x9501;&#x7684;&#x539F;&#x56E0;</h1>
<p>&#x9020;&#x6210;&#x6B7B;&#x9501;&#x7684;&#x539F;&#x56E0;&#x5C31;&#x662F;&#x591A;&#x4E2A;&#x7EBF;&#x7A0B;&#x6216;&#x8FDB;&#x7A0B;&#x5BF9;&#x540C;&#x4E00;&#x4E2A;&#x8D44;&#x6E90;&#x7684;&#x4E89;&#x62A2;&#x6216;&#x76F8;&#x4E92;&#x4F9D;&#x8D56;&#x3002;</p>
<p>&#x4E0E;java&#x5BF9;&#x6BD4;&#xFF1A;</p>
<p>&#x9501;&#x5B9A;&#x5C31;&#x50CF;&#x6211;&#x4EEC;&#x4E3A;&#x67D0;&#x4E2A;&#x7EBF;&#x7A0B;&#x7684;run&#xFF08;&#xFF09;&#x52A0;&#x9501;&#xFF0C;&#x5F53;&#x5B9E;&#x4F8B;&#x5316;&#x591A;&#x4E2A;&#x7EBF;&#x7A0B;&#x65F6;&#xFF0C;&#x5FC5;&#x987B;&#x7B49;&#x4E00;&#x4E2A;&#x7EBF;&#x7A0B;&#x5168;&#x90E8;&#x6267;&#x884C;&#x5B8C;&#x6210;&#x65F6;&#xFF0C;&#x91CA;&#x653E;&#x9501;&#xFF0C;&#x5176;&#x4ED6;&#x7EBF;&#x7A0B;&#x624D;&#x6709;&#x673A;&#x4F1A;&#x6267;&#x884C;&#x3002;for update&#x529F;&#x80FD;&#x4E0A;&#x4E00;&#x6837;&#xFF0C;&#x5C31;&#x662F;&#x4E3A;&#x4E00;&#x4E2A;select&#x8BED;&#x53E5;&#x52A0;&#x9501;&#xFF0C;&#x8FD9;&#x6837;&#x5176;&#x4ED6;&#x7528;&#x6237;&#xFF08;&#x4F1A;&#x8BDD;&#xFF09;&#x5BF9;&#x8FD9;&#x4E2A;&#x8868;&#x8FDB;&#x884C;DML&#x8BED;&#x53E5;&#x5904;&#x7406;&#x65F6;&#xFF0C;&#x5C31;&#x4F1A;&#x5904;&#x4E8E;&#x7B49;&#x5F85;&#x72B6;&#x6001;&#xFF0C;&#x7B49;&#x5F85;selec&#x6267;&#x884C;commit&#x6216;rollback(&#x76F8;&#x5F53;&#x4E8E;&#x7EBF;&#x7A0B;&#x91CA;&#x653E;&#x9501;)&#x540E;&#xFF0C;&#x624D;&#x53EF;&#x4EE5;&#x5BF9;&#x8868;&#x8FDB;&#x884C;&#x6267;&#x884C;DML&#x8BED;&#x53E5;&#x3002;</p>
<h2 id="for-update-&#x4E0E;for-update-of&#x8FDB;&#x884C;&#x5BF9;&#x6BD4;">For update &#x4E0E;for update of&#x8FDB;&#x884C;&#x5BF9;&#x6BD4;</h2>
<p>For update &#x4E3A;&#x884C;&#x52A0;&#x9501;</p>
<p>for update of&#x4E3A;&#x5217;&#x52A0;&#x9501;</p>
<p>for update of columns &#x7528;&#x5728;&#x591A;&#x8868;&#x8FDE;&#x63A5;&#x9501;&#x5B9A;&#x65F6;&#xFF0C;&#x53EF;&#x4EE5;&#x6307;&#x5B9A;&#x8981;&#x9501;&#x5B9A;&#x7684;&#x662F;&#x54EA;&#x51E0;&#x5F20;&#x8868;&#xFF0C;&#x800C;&#x5982;&#x679C;&#x8868;&#x4E2D;&#x7684;&#x5217;&#x6CA1;&#x6709;&#x5728;for update of &#x540E;&#x9762;&#x51FA;&#x73B0;&#x7684;&#x8BDD;&#xFF0C;&#x5C31;&#x610F;&#x5473;&#x7740;&#x8FD9;&#x5F20;&#x8868;&#x5176;&#x5B9E;&#x5E76;&#x6CA1;&#x6709;&#x88AB;&#x9501;&#x5B9A;&#xFF0C;&#x5176;&#x4ED6;&#x7528;&#x6237;&#x662F;&#x53EF;&#x4EE5;&#x5BF9;&#x8FD9;&#x4E9B;&#x8868;&#x7684;&#x6570;&#x636E;&#x8FDB;&#x884C;update&#x64CD;&#x4F5C;&#x7684;&#x3002;</p>
<h3 id="&#x4F1A;&#x8BDD;&#xFF08;&#x7528;&#x6237;&#xFF09;&#x4E00;">&#x4F1A;&#x8BDD;&#xFF08;&#x7528;&#x6237;&#xFF09;&#x4E00;</h3>
<pre><code class="lang-plsql">-------------------------------- 
--for update &#x884C;&#x52A0;&#x9501;
--sql-1 &#x4E3A;&#x6240;&#x6709;&#x884C;&#x52A0;&#x9501; &#x65E0;&#x9650;&#x7B49;&#x5F85;
select * from cux_em_22423 for update;
--&#x8FD0;&#x884C;&#x7528;&#x6237;&#x4E00;&#x7684;sql-1&#x8BED;&#x53E5;&#xFF0C;&#x518D;&#x8FD0;&#x884C;&#x7528;&#x6237;&#x4E8C;&#x7684;sql-1&#x8BED;&#x53E5;&#xFF0C;&#x7528;&#x6237;&#x4E8C;&#x7684;&#x8BED;&#x53E5;&#x65E0;&#x6CD5;&#x8FD0;&#x884C;
commit;
--&#x63D0;&#x4EA4;&#xFF0C;&#x7528;&#x6237;&#x4E8C;&#x53EF;&#x8FD0;&#x884C;&#x3002;

--sql-2 &#x4E3A;&#x7279;&#x5B9A;&#x884C;&#x52A0;&#x9501; &#x65E0;&#x9650;&#x7B49;&#x5F85;
select * from cux_em_22423 e where e.employes_id=2  for update;
--&#x8FD0;&#x884C;&#x7528;&#x6237;&#x4E00;&#x7684;sql-2&#x8BED;&#x53E5;&#xFF0C;&#x518D;&#x8FD0;&#x884C;&#x7528;&#x6237;&#x4E8C;&#x7684;sql-2&#x8BED;&#x53E5;&#xFF0C;&#x7528;&#x6237;&#x4E8C;&#x7684;&#x8BED;&#x53E5;&#x53EF;&#x8FD0;&#x884C;
commit;

--&#x8FD0;&#x884C;&#x7528;&#x6237;&#x4E00;&#x7684;sql-1&#x8BED;&#x53E5;&#xFF0C;&#x518D;&#x8FD0;&#x884C;&#x7528;&#x6237;&#x4E8C;&#x7684;sql-3&#x8BED;&#x53E5;&#xFF0C;&#x7528;&#x6237;&#x4E8C;&#x7684;&#x8BED;&#x53E5;&#x65E0;&#x6CD5;&#x8FD0;&#x884C;
commit;
--&#x63D0;&#x4EA4;&#xFF0C;&#x7528;&#x6237;&#x4E8C;&#x53EF;&#x8FD0;&#x884C;&#x3002;

--&#x8FD0;&#x884C;&#x7528;&#x6237;&#x4E00;&#x7684;sql-1&#x8BED;&#x53E5;&#xFF0C;&#x518D;&#x8FD0;&#x884C;&#x7528;&#x6237;&#x4E8C;&#x7684;sql-4&#x8BED;&#x53E5;&#xFF0C;&#x7528;&#x6237;&#x4E8C;&#x7684;&#x8BED;&#x53E5;&#x53EF;&#x8FD0;&#x884C;
commit;

--&#x8FD0;&#x884C;&#x7528;&#x6237;&#x4E00;&#x7684;sql-1&#x8BED;&#x53E5;&#xFF0C;&#x518D;&#x8FD0;&#x884C;&#x7528;&#x6237;&#x4E8C;&#x7684;sql-5&#x8BED;&#x53E5;&#xFF0C;&#x7528;&#x6237;&#x4E8C;&#x7684;&#x8BED;&#x53E5;&#x62A5;&#x9519;
commit;

-------------------------------- 
--for update of &#x5217;&#x52A0;&#x9501;
--&#x5355;&#x8868;&#x4F7F;&#x7528;&#x4E0E;&#x5168;&#x884C;&#x52A0;&#x9501;&#x6548;&#x679C;&#x76F8;&#x540C;&#xFF0C;&#x4E3B;&#x8981;&#x7528;&#x4E8E;&#x591A;&#x8868;&#x4F7F;&#x7528;

--sql-3
select * from cux_em_22423 e for update of e.employes_id;
--&#x6548;&#x679C;&#x4E0E;sql-1&#x76F8;&#x540C;
commit;

--sql-4 &#x591A;&#x8868;&#x52A0;&#x9501; &#x5BF9;cux_em_22423&#x7684;employes_id&#x52A0;&#x9501;&#xFF0C;
--&#x56E0;&#x4E3A;cux_department_em_22423&#x6CA1;&#x6709;employes_id&#x5217;&#xFF0C;&#x6240;&#x4EE5;&#x7528;&#x6237;&#x4E8C;&#x53EF;&#x4EE5;&#x5BF9;cux_department_em_22423&#x8FDB;&#x884C;&#x64CD;&#x4F5C;
--&#x65E0;&#x6CD5;&#x5BF9;cux_em_22423&#x8FDB;&#x884C;&#x64CD;&#x4F5C;
select * FROM cux_department_em_22423 de,cux_em_22423 e
where e.deparement_id=de.deparement_id(+)
for update of e.employes_id;
commit;

--sql-5
--&#x5F53;&#x6211;&#x4EEC;&#x60F3;&#x6267;&#x884C;&#x6E38;&#x6807;&#x5F71;&#x54CD;&#x7684;&#x884C;&#x65F6;
--for update...... where current of &#x5FC5;&#x987B;&#x4E0E;for update&#x4E00;&#x8D77;&#x7528;
DECLARE
  CURSOR cur_emp IS
    SELECT e.employee_id
      FROM cux_employees e
     WHERE e.manager_id = 100 for update;
BEGIN
  FOR rec IN cur_emp
  LOOP
    UPDATE cux_employees
       SET salary = salary + 100
     WHERE CURRENT OF cur_emp;
  END LOOP;
END;
commit;
</code></pre>
<h3 id="&#x4F1A;&#x8BDD;&#xFF08;&#x7528;&#x6237;&#xFF09;&#x4E8C;">&#x4F1A;&#x8BDD;&#xFF08;&#x7528;&#x6237;&#xFF09;&#x4E8C;</h3>
<pre><code class="lang-plsql">--sql-1
UPDATE cux_em_22423
   SET employes_name = &apos;yf22423&apos;;
COMMIT
--&#x7528;&#x6237;&#x4E00;&#x672A;&#x63D0;&#x4EA4;&#x65F6;&#x65E0;&#x6CD5;&#x8FD0;&#x884C;&#xFF0C;&#x4E00;&#x76F4;&#x7B49;&#x5F85;,&#x76F4;&#x81F3;&#x7528;&#x6237;&#x4E00;&#x63D0;&#x4EA4;&#x6216;&#x56DE;&#x6EDA;

--sql-2
UPDATE cux_em_22423 SET employes_name = &apos;yf22423-1&apos; WHERE employes_id = 1;
COMMIT
--&#x53EF;&#x8FD0;&#x884C;

--sql-3
  SELECT *
    FROM cux_em_22423
     FOR UPDATE;
COMMIT
--&#x7528;&#x6237;&#x4E00;&#x672A;&#x63D0;&#x4EA4;&#x65F6;&#x65E0;&#x6CD5;&#x8FD0;&#x884C;&#xFF0C;&#x4E00;&#x76F4;&#x7B49;&#x5F85;,&#x76F4;&#x81F3;&#x7528;&#x6237;&#x4E00;&#x63D0;&#x4EA4;&#x6216;&#x56DE;&#x6EDA;

--sql-4
  SELECT *
    FROM cux_em_22423;
COMMIT
--&#x53EF;&#x8FD0;&#x884C;&#xFF0C;&#x56E0;&#x4E3A;&#x884C;&#x7EA7;&#x9501;&#x4E0D;&#x4F1A;&#x5F71;&#x54CD;&#x7EAF;&#x7CB9;&#x7684;select&#x8BED;&#x53E5;

--sql-5
  SELECT *
    FROM cux_em_22423
     FOR UPDATE NOWAIT;
COMMIT;
--&#x7528;&#x6237;&#x4E00;&#x672A;&#x63D0;&#x4EA4;&#x65F6;,&#x76F4;&#x63A5;&#x62A5;&#x5F02;&#x5E38;

--sql-6
SELECT *
  FROM cux_em_22423
   FOR UPDATE wait 3;
COMMIT;
--&#x7528;&#x6237;&#x4E00;&#x672A;&#x63D0;&#x4EA4;&#x65F6;,&#x7B49;3s,&#x4ECD;&#x672A;&#x8FD0;&#x884C;&#xFF0C;&#x62A5;&#x5F02;&#x5E38;
</code></pre>
<h1 id="&#x67E5;&#x770B;&#x6B7B;&#x9501;">&#x67E5;&#x770B;&#x6B7B;&#x9501;</h1>
<pre><code class="lang-plsql">--&#x67E5;&#x770B;&#x6B7B;&#x9501;
SELECT se.username, --&#x6570;&#x636E;&#x5E93;&#x7528;&#x6237;&#x540D;
       lo.session_id, --session&#x6807;&#x8BC6;
       se.serial#, --session&#x5E8F;&#x5217;
       se.audsid, --&#x5BA1;&#x6838;&#x4F1A;&#x8BDD;id
       se.lockwait, --&#x4F1A;&#x8BDD;&#x7B49;&#x5F85;&#x7684;&#x9501;&#x7684;&#x5730;&#x5740;
       se.osuser, --&#x5BA2;&#x6237;&#x7AEF;&#x7528;&#x6237;&#x540D;
       se.status, --&#x72B6;&#x6001;
       se.machine, --&#x5BA2;&#x6237;&#x7AEF;
       se.program, --&#x5BA2;&#x6237;&#x7AEF;&#x7A0B;&#x5E8F;
       se.sql_hash_value, --sql&#x54C8;&#x5E0C;&#x503C;
       se.sql_address --SQL&#x5730;&#x5740;
  FROM v$session       se,
       v$locked_object lo
 WHERE se.sid = lo.session_id;
</code></pre>
<h1 id="&#x67E5;&#x770B;&#x5F15;&#x8D77;&#x6B7B;&#x9501;&#x7684;&#x8BED;&#x53E5;">&#x67E5;&#x770B;&#x5F15;&#x8D77;&#x6B7B;&#x9501;&#x7684;&#x8BED;&#x53E5;</h1>
<pre><code class="lang-plsql">--&#x67E5;&#x770B;&#x5F15;&#x8D77;&#x6B7B;&#x9501;&#x7684;&#x8BED;&#x53E5;
SELECT se.user#, --&#x7528;&#x6237;id
       se.username, --&#x7528;&#x6237;&#x540D;
       se.osuser, --&#x5BA2;&#x6237;&#x7AEF;&#x7528;&#x6237;&#x540D;
       se.sid, --session id
       se.serial#, --session&#x5E8F;&#x5217;
       st.sql_text --sql&#x8BED;&#x53E5;
  FROM v$sqltext       st,
       v$session       se,
       v$locked_object lo
 WHERE se.sid = lo.session_id
   AND st.address = se.sql_address
   AND st.hash_value = se.sql_hash_value
 ORDER BY st.piece;
</code></pre>
<h1 id="&#x6740;&#x6B7B;&#x6B7B;&#x9501;">&#x6740;&#x6B7B;&#x6B7B;&#x9501;</h1>
<pre><code class="lang-plsql">--&#x6740;&#x6B7B;&#x6B7B;&#x9501;
ALTER system kill session &apos;509,15654&apos;; --session id,session&#x5E8F;&#x5217;
</code></pre>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="012_时间日期处理.html" class="navigation navigation-prev " aria-label="Previous page: 012_时间日期处理">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="014_邮件发送.html" class="navigation navigation-next " aria-label="Next page: 014_邮件发送">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"013_死锁","level":"1.5.13","depth":2,"next":{"title":"014_邮件发送","level":"1.5.14","depth":2,"path":"004_Oracle/014_邮件发送.md","ref":"004_Oracle/014_邮件发送.md","articles":[]},"previous":{"title":"012_时间日期处理","level":"1.5.12","depth":2,"path":"004_Oracle/012_时间日期处理.md","ref":"004_Oracle/012_时间日期处理.md","articles":[]},"dir":"ltr"},"config":{"plugins":["github","splitter","-lunr","-search","search-plus","simple-page-toc","copy-code-button","page-toc-button","back-to-top-button","chapter-fold","auto-scroll-table","-sharing","livereload"],"root":".","styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"chapter-fold":{},"github":{"url":"https://github.com/xiajiajinxuan"},"livereload":{},"simple-page-toc":{"maxDepth":3,"skipFirstH1":false},"splitter":{},"auto-scroll-table":{},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"page-toc-button":{"maxTocDepth":2,"minTocSize":2},"back-to-top-button":{},"copy-code-button":{},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"search-plus":{}},"theme":"default","author":"xiajiajinxuan","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"瑕家瑾轩_Note","language":"zh-hans","gitbook":"*","description":"瑕家瑾轩_Note"},"file":{"path":"004_Oracle/013_死锁.md","mtime":"2019-09-02T01:23:23.913Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-08-17T07:13:06.707Z"},"basePath":"..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../gitbook/gitbook.js"></script>
    <script src="../gitbook/theme.js"></script>
    
        
        <script src="../gitbook/gitbook-plugin-github/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-splitter/splitter.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search-plus/jquery.mark.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search-plus/search.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-copy-code-button/toggle.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-page-toc-button/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-back-to-top-button/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-chapter-fold/chapter-fold.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-auto-scroll-table/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-livereload/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

